﻿package mortal.game.resource.tableConfig
{
    import Message.DB.Tables.*;
    import com.gengine.resource.*;
    import mortal.game.view.common.*;

    public class WorldBossLevelConfig extends Object
    {
        private var _ary:Array;
        private static var _instance:WorldBossLevelConfig;

        public function WorldBossLevelConfig()
        {
            this._ary = new Array();
            if (_instance != null)
            {
                throw new Error("WorldBossLevelConfig 单例");
            }
            this.init();
            return;
        }// end function

        public function init() : void
        {
            var _loc_1:* = ConfigManager.instance.getJSONByFileName("t_world_boss_config_level.json");
            this.write(_loc_1);
            return;
        }// end function

        private function write(param1:Object) : void
        {
            var _loc_2:TWorldBossConfigLevel = null;
            var _loc_3:Object = null;
            for each (_loc_3 in param1)
            {
                
                _loc_2 = new TWorldBossConfigLevel();
                ClassTypesUtil.copyValue(_loc_2, _loc_3);
                this._ary.push(_loc_2);
            }
            this._ary.sort(this.sortById);
            return;
        }// end function

        private function sortById(param1:TWorldBossConfigLevel, param2:TWorldBossConfigLevel) : int
        {
            if (param1.id < param2.id)
            {
                return -1;
            }
            if (param1.id > param2.id)
            {
                return 1;
            }
            return 0;
        }// end function

        public function getAllData() : Array
        {
            return this._ary;
        }// end function

        public static function get instance() : WorldBossLevelConfig
        {
            if (_instance == null)
            {
                _instance = new WorldBossLevelConfig;
            }
            return _instance;
        }// end function

    }
}
